﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LightCube
{
    public class Mono8 : LightCubeBase
    {
        private byte[] frame = new byte[64];

        public const int Size = 8;

        public Mono8()
            : base(Size)
        {

        }

        public override byte[] EncodeFrame(Buffer3D buffer)
        {
            Point3D pixel = Point3D.Zero;
            for (; pixel.Z < buffer.Size; pixel.Z++)
            {
                for (; pixel.Y < buffer.Size; pixel.Y++)
                {
                    for (; pixel.X < buffer.Size; pixel.X++)
                    {
                        if (buffer.GetPixcel(pixel) != LightColor.Black)
                            frame[pixel.Z * 8 + pixel.Y] &= (byte)(1 << pixel.X);
                    }
                }
            }
            return frame;
        }
    }
}
